
/**
 * Please modify this class to meet your needs
 * This class is not complete
 */

package com.gaoxk.cxf.service.s30064000001;

import com.alibaba.fastjson.JSONObject;
import com.gaoxk.cxf.service.dao.TServerendpointDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.jws.WebService;
import java.net.InetAddress;
import java.net.UnknownHostException;

//import com.txqz.entity.UploadMessage;
//import com.txqz.service.UploadFilesService;
//import com.txqz.util.BeanUtils;
//import org.springframework.jdbc.core.JdbcTemplate;

/**
 * This class was generated by Apache CXF 3.5.6
 * 2023-07-12T15:27:55.091+08:00
 * Generated source version: 3.5.6
 *
 */
@Service(value = "ESBServerSoapEndpointImpl2")
@WebService(
                      serviceName = "S30064000001",
                      portName = "ESBServerSoapEndpoint",
                      targetNamespace = "http://esb.dcitsbiz.com/services/30064000001/wsdl",
                      wsdlLocation = "classpath:wsdl/30064000001/30064000001.wsdl",
        endpointInterface = "com.gaoxk.cxf.service.s30064000001.ESBServerPortType")

public class ESBServerSoapEndpointImpl implements ESBServerPortType {

    private static final Logger LOG = LoggerFactory.getLogger(ESBServerSoapEndpointImpl.class.getName());
    //@Resource(name="TServerendpointDao")
    @Autowired
    private TServerendpointDao serverendpointdao;
    /* (non-Javadoc)
     * @see com.txqz.cxf.service.s30064000001.ESBServerPortType#op11(com.txqz.cxf.service.s30064000001.Req3006400000111Type req3006400000111)*
     */
    public Rsp3006400000111Type op11(Req3006400000111Type req) {
        LOG.info("Executing operation op11");
        String s = JSONObject.toJSONString(req);
        System.out.println("参数输入------------------------------------------" + s);
        try {
            //总返回
            Rsp3006400000111Type resp = new Rsp3006400000111Type();
            //sysHead组装
            RspSysHeadType rspSysHeadType = new RspSysHeadType();
            rspSysHeadType.setReqSeq(req.getReqSysHead().getReqSeq()==null?"":req.getReqSysHead().getReqSeq());
            rspSysHeadType.setChannelID(req.getReqSysHead().getChannelID()==null?"":req.getReqSysHead().getChannelID());
            rspSysHeadType.setReqTime(req.getReqSysHead().getReqTime()==null?"":req.getReqSysHead().getReqTime());
            rspSysHeadType.setReqSysID(req.getReqSysHead().getReqSysID()==null?"":req.getReqSysHead().getReqSysID());
            rspSysHeadType.setReqDate(req.getReqSysHead().getReqDate()==null?"":req.getReqSysHead().getReqDate());
            rspSysHeadType.setDomainRef(req.getReqSysHead().getDomainRef()==null?"":req.getReqSysHead().getDomainRef());
            rspSysHeadType.setAcceptLang(req.getReqSysHead().getAcceptLang()==null?"":req.getReqSysHead().getAcceptLang());
            rspSysHeadType.setGlobalSeq(req.getReqSysHead().getGlobalSeq()==null?"":req.getReqSysHead().getGlobalSeq());
            rspSysHeadType.setOrgSysID(req.getReqSysHead().getOrgSysID()==null?"":req.getReqSysHead().getOrgSysID());
            rspSysHeadType.setSvcScn(req.getReqSysHead().getSvcScn()==null?"":req.getReqSysHead().getSvcScn());
            rspSysHeadType.setLegOrgID(req.getReqSysHead().getLegOrgID()==null?"":req.getReqSysHead().getLegOrgID());
            rspSysHeadType.setServiceID(req.getReqSysHead().getServiceID()==null?"":req.getReqSysHead().getServiceID());
            try {
                rspSysHeadType.setDomainRef(InetAddress.getLocalHost().getHostAddress());
            } catch (UnknownHostException e) {
                e.printStackTrace();
            }

//            TServerendpoint aa =  serverendpointdao.selectByPrimaryKey(Long.valueOf(1));
//            LOG.info(aa.getEndpbeanname());
//            String servbeanname = null;
//            String endpbeanname = null;
//            String endpurlpath = null;
//            List<Map<String, Object>> serverlist =serverendpointdao.selectAllSxServer();
//            for (Map<String, Object> map : serverlist) {
//                    servbeanname = MapUtil.getString(map, "servbeanname");
//
//                    endpbeanname = MapUtil.getString(map, "endpbeanname");
//                    endpurlpath = MapUtil.getString(map, "endpurlpath");
//                    LOG.info("servbeanname=${"+servbeanname+"}") ;
//                    LOG.info("endpbeanname=${"+endpbeanname+"}") ;
//                    LOG.info("endpurlpath=${"+endpurlpath+"}") ;
//
//            }
            //组装AppHeader
            RspAppHeadType rspAppHeadType = new RspAppHeadType();
            rspAppHeadType.setBrId(req.getReqAppHead().getBrId()==null?"":req.getReqAppHead().getBrId());
            rspAppHeadType.setTlrNo(req.getReqAppHead().getTlrNo()==null?"":req.getReqAppHead().getTlrNo());
            resp.setRspAppHead(rspAppHeadType);
            ///组装local头
            RspLocalHeadType rspLocalHeadType = new RspLocalHeadType();
            rspLocalHeadType.setPDERTR("");
            rspLocalHeadType.setPDLDTC("");
            rspLocalHeadType.setPDTLSQ("");
            rspLocalHeadType.setPDTRCD(req.getReqLocalHead().getPDTRCD()==null?"":req.getReqLocalHead().getPDTRCD());
            rspLocalHeadType.setSYSDADDR(req.getReqLocalHead().getSYSDADDR()==null?"":req.getReqLocalHead().getSYSDADDR());
            rspLocalHeadType.setSYSMACFLAG(req.getReqLocalHead().getSYSMACFLAG()==null?"":req.getReqLocalHead().getSYSMACFLAG());
            rspLocalHeadType.setSYSPINSEED(req.getReqLocalHead().getSYSPINSEED()==null?"":req.getReqLocalHead().getSYSPINSEED());
            rspLocalHeadType.setSYSMKEYVER(req.getReqLocalHead().getSYSMKEYVER()==null?"":req.getReqLocalHead().getSYSMKEYVER());
            rspLocalHeadType.setSYSSEQNUM(req.getReqLocalHead().getSYSSEQNUM()==null?"":req.getReqLocalHead().getSYSSEQNUM());
            rspLocalHeadType.setSYSEFLAG(req.getReqLocalHead().getSYSEFLAG()==null?"":req.getReqLocalHead().getSYSEFLAG());
            rspLocalHeadType.setSYSMACSBNO(req.getReqLocalHead().getSYSMACSBNO()==null?"":req.getReqLocalHead().getSYSMACSBNO());
            resp.setRspLocalHead(rspLocalHeadType);
//            UploadMessage uploadMessage = new UploadMessage();
//            uploadMessage.setApplicationNumber(req.getReqAppBody().getApplicationNumber());
//            uploadMessage.setBatchFlag(req.getReqAppBody().getBatchFlag());
//            uploadMessage.setBatchNumber(req.getReqAppBody().getBatchNumber());
//            uploadMessage.setBizCategory(req.getReqAppBody().getBizCategory());
//            uploadMessage.setEncFlag(req.getReqAppBody().getEncFlag());
//            uploadMessage.setFileContent(req.getReqAppBody().getFileContent());
//            uploadMessage.setFileName(req.getReqAppBody().getFileName());
//            uploadMessage.setInstitutionCode(req.getReqAppBody().getInstitutionCode());
//            uploadMessage.setSendFlag(req.getReqAppBody().getSendFlag());
//            uploadMessage.setFileType(req.getReqAppBody().getFileType());
//            uploadMessage.setUploadTime(req.getReqAppBody().getUploadTime());
//            uploadMessage.setFileSize(Long.valueOf(req.getReqAppBody().getFileSize()));
//            UploadFilesService uploadFilesService = BeanUtils.getBean(UploadFilesService.class);
//            JdbcTemplate jdbcTemplate = BeanUtils.getBean(JdbcTemplate.class);
//            Map<String, String> map = uploadFilesService.uploadFiles(uploadMessage, jdbcTemplate);
//            String retCode = map.get("retCode");
//            String errMsg = map.get("errMsg");
//            String body = map.get("body");
//            String msg = body.replace("<", "^|");
//            String dcotc = msg.replace(">", "|^");
            String retCode="";
            String errMsg="";
            
            Rsp3006400000111Type.RspAppBody rspAppBody = new Rsp3006400000111Type.RspAppBody();
            //rspAppBody.setRetCode(retCode=="01"?"000000":retCode);
            //rspAppBody.setErrMsg(errMsg==null?"":errMsg);
            rspAppBody.setRetCode("000000");
            rspAppBody.setErrMsg("成功");
            rspAppBody.setBeYong5("");
            rspAppBody.setBeYong6("dcotc");
            rspSysHeadType.setRetCode(rspAppBody.getRetCode());
            rspSysHeadType.setRetMsg(rspAppBody.getErrMsg());
            resp.setRspSysHead(rspSysHeadType);
            resp.setRspAppBody(rspAppBody);
            String re = JSONObject.toJSONString(resp);
            System.out.println("参数结果输出------------------------------------------" + re);
            return resp;
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
    }

}
